Add Udemy video lecture segment skipping support#24
Add Udemy video lecture segment skipping support#24devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
Conversation
- Add udemyContent.ts: Dedicated content script for Udemy with completion-safe skip mechanism (mute + 16x speed instead of seeking) to preserve Udemy's course progress tracking - Add udemyUtils.ts: Udemy platform detection, video ID extraction, player element selectors - Update Chrome manifest: Add Udemy host permissions and content script injection for udemy.com/course/*/learn/lecture/* pages - Update V2 manifest: Add Udemy permissions and content script for Firefox/Safari compatibility - Update webpack config: Add udemyContent entry point Supported categories: sponsor, selfpromo, interaction, intro, outro, filler, preview, music_offtopic Features: - Completion-safe skipping: Mutes audio and speeds up to 16x during segments so Udemy still records progress as watched - SPA navigation detection for Udemy's single-page app - Preview bar overlay showing segment positions - Skip notice UI with category indicators - Manual and auto-skip modes based on user configuration - Segment creation support from popup Co-Authored-By: Erkin Alp Güney <erkinalp9035@gmail.com>
Original prompt from Erkin
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Add removeVideoListeners() to properly clean up event listeners on
lecture change, preventing duplicate handlers
- Remove duplicate sendResponse({}) fallthrough at end of message listener
- Add return true to all message handler cases to keep the message channel
open for async responses
- Add explicit sendResponse({}) in update case before returning
Co-Authored-By: Erkin Alp Güney <erkinalp9035@gmail.com>
- Return false from early guard clause when not on Udemy - Return false as default after switch statement for unmatched messages Co-Authored-By: Erkin Alp Güney <erkinalp9035@gmail.com>
To test this pull request, follow the instructions in the wiki.
Summary
Adds a dedicated content script for Udemy lecture pages that enables segment skipping (sponsor, selfpromo, interaction, intro, outro, filler, preview) on
udemy.com/course/*/learn/lecture/*URLs.The key design choice is completion-safe skipping: instead of seeking past segments (which would break Udemy's course progress tracking), the extension mutes audio and sets playback to 16x speed so the segment plays through quickly while Udemy still counts it as watched.
Changes
src/udemyContent.ts(new, ~741 lines): Standalone content script handling segment fetching, skip scheduling, preview bar overlay, skip notice UI, and popup message handling for Udemy pagessrc/utils/udemyUtils.ts(new, 141 lines): Udemy platform detection, video ID extraction from URL, and DOM selectors for video player elementsmanifest/chrome-manifest-extra.json: Addedhttps://*.udemy.com/*host permission and content script entry for Udemy lecture pagesmanifest/manifest-v2-extra.json: Same for Manifest V2 (Firefox/Safari)webpack/webpack.common.js: AddedudemyContentwebpack entry pointUpdates since last revision
Fixed issues from initial review:
Duplicate→ Removed fallthrough; each case now callssendResponse({})at end of message listenersendResponseexplicitly and returnstrueNo event listener cleanup→ AddedremoveVideoListeners()function; called on lecture change and before re-adding listeners to prevent duplicatesMissing→ All switch cases nowreturn truefor async message casesreturn trueto keep the message channel open16x playback rate assumption:
FAST_FORWARD_RATE = 16is hardcoded. Browsers may capvideo.playbackRate— needs validation that Udemy's player actually accepts this value.Video ID format vs API compatibility: Generated IDs are
udemy-{courseSlug}-{lectureId}— these are much longer than YouTube's 11-char IDs. Verify the hash-prefix API lookup ingetSegmentsForVideo()handles these correctly.CSS selectors are speculative: Udemy uses CSS modules with generated hash suffixes (e.g.
--container--YDQRW). The selectors use[class*='...']patterns which are fragile and have not been tested against the live site.Human review checklist
getSegmentsForVideo()works with long non-YouTube video IDs (udemy-{slug}-{id})video.playbackRate = 16on Udemy's player in target browsers (Chrome, Firefox)[class*='video-player'], etc.) match current Udemy DOM structureLink to Devin session: https://app.devin.ai/sessions/1aba184a70f04b36a9a2fe0cd79c51c2
Requested by: @erkinalp